#include <AT89X52.h>
#define RCLK P1_5
#define SDATA P1_6
#define SCLK P1_7
void Senddata(unsigned char Xdata,unsigned char Ydata)
{
unsigned char i;
RCLK=0;
for(i=0;i<8;i++)
{
SDATA=Xdata & 0x01;
SCLK=1;
SCLK=0;
Xdata=Xdata>>1;
}
for(i=0;i<8;i++)
{
SDATA=Ydata & 0x01;
SCLK=1;
SCLK=0;
Ydata=Ydata>>1;
}
RCLK=1;
}
void Delay()
{
int b;
for(b=1000;b>0;b--)
{
;
}
}
void main(void)
{
int c;
char q;
unsigned char a[8]={0x18,0x3c,0x7e,0xdb,0x99,0x18,0x18,0x18};
unsigned char d[8]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
while(1)
{
for(c=0;c<8;c++)
{
Delay();
Senddata(d[c],a[c]);
}
for(c=0;c<8;c++)
{
Delay();
Senddata(d[c],a[c]);
}
for(c=0;c<8;c++)
{
Delay();
Senddata(d[c],a[c]);
}
for(c=0;c<8;c++)
{
Delay();
Senddata(d[c],a[c]);
}
q=a[0];
a[0]=a[1];
a[1]=a[2];
a[2]=a[3];
a[3]=a[4];
a[4]=a[5];
a[5]=a[6];
a[6]=a[7];
a[7]=q;
}
}
